﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using OGAMRL.screens;
using OGAMRL.units;

namespace OGAMRL.screens
{
    public class GameState
    {
        public enum state
        {
            TITLE,
            MAIN_MENU,
            CHAR_CREATION,
            CHAR_SKILLS,
            PLAYING,
            GAME_OVER,
        };
        public Screen currentScreen;
        public state currentState;
        private Screen titleScreen;
        private Screen createScreen;
        private Screen mainMenu;
        private Screen gameOver;
        private Screen skillScreen;
        private Screen playing;
        private Texture2D[] screenTextures;
        private List<SpriteFont> fontList;

        //constructors
        public GameState(int h, int w, SpriteFont f)
        {
            //fonts
            fontList = new List<SpriteFont>();
            fontList.Add(f);
            //initialize screens
            titleScreen = new Title(h,w);
            createScreen = new Create(h,w);
            mainMenu = new MainMenu(h,w);
            gameOver = new GameOver(h,w);
            skillScreen = new SkillScreen(h,w);
            playing = new Playing(h,w,f);
            //set textures
            screenTextures = new Texture2D[2];
            currentState = state.TITLE;
            currentScreen = titleScreen;
        }
        //mutators
        public Screen getCurrentScreen()
        {
            return currentScreen;
        }
        public void setCurrentScreen(Screen screen)
        {
            this.currentScreen = screen;
        }
        public state getState()
        {
            return currentState;
        }
        public void setState(state s)
        {
            this.currentState = s;
            //set the screen based on gamestate 
            if (currentState == state.MAIN_MENU)
                currentScreen = mainMenu;
            if (currentState == state.TITLE)
                currentScreen = titleScreen;
            if (currentState == state.PLAYING)
                currentScreen = playing;
        }
        public Texture2D[] getScreenTextures()
        {
            return screenTextures;
        }
        public void setScreenTextures(Texture2D[] t)
        {
            screenTextures = t;
            titleScreen.setTexture(t[0]);
            mainMenu.setTexture(t[1]);
        }
        //affectors
        public void updateScreen()
        {
          
        }
    }
}
